<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

</body>
<script>
    // string  number  boolean  null undefined  

    // Number()   传入一个参数,将其转化为数字并返回  (将其他类型转化为数字)

    // var result = Number("100");
    // console.log(result);

    /* console.log(Number("100"));  // 100
    console.log(Number("100a"));  // NaN
    
    console.log(Number(100));  // 100

    console.log(Number(true));  // 1
    console.log(Number(false));  // 0
    console.log(Number(null));  // 0
    console.log(Number(undefined));  // NaN */


    // String()  传入一个参数,将其转化为字符串并返回  (将其他类型转化为字符串)

    console.log(String("100"));  //  "100"
    console.log(String("100a"));  //  "100a"
    
    console.log(String(100));  // "100"

    console.log(String(true));  // "true"
    console.log(String(false));  // "false"

    console.log(String(null));  //  "null"
    console.log(String(undefined));  //  "undefined"
  

</script>
</html>